Fixed selection attributes handling after softBreak.#19918
Open
Fixed selection attributes handling after softBreak.#19918
Conversation
Member
Mati365
reviewed
Mar 9, 2026
Mati365
requested changes
Mar 11, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Engine core hardcodes plugin-specific element name
- Replaced the hardcoded
softBreakelement check with schema-based inline non-object handling that copies only$textattributes markedcopyOnEnter, removing plugin-name coupling in engine selection logic.
- Replaced the hardcoded
Or push these changes by commenting:
@cursor push 09cbb82ebf
Preview (09cbb82ebf)
diff --git a/packages/ckeditor5-engine/src/model/documentselection.ts b/packages/ckeditor5-engine/src/model/documentselection.ts
--- a/packages/ckeditor5-engine/src/model/documentselection.ts
+++ b/packages/ckeditor5-engine/src/model/documentselection.ts
@@ -1278,11 +1278,20 @@
return node.getAttributes();
}
- if ( node.is( 'element', 'softBreak' ) ) {
+ if ( !schema.isInline( node ) ) {
+ return null;
+ }
+
+ if ( !schema.isObject( node ) ) {
const attributes: Array<[ string, unknown ]> = [];
+ // Inline non-object elements create a "soft" attribute boundary and can optionally carry over
+ // text attributes marked as copyOnEnter.
for ( const [ key, value ] of node.getAttributes() ) {
- if ( schema.checkAttribute( '$text', key ) ) {
+ if (
+ schema.checkAttribute( '$text', key ) &&
+ schema.getAttributeProperties( key ).copyOnEnter
+ ) {
attributes.push( [ key, value ] );
}
}
@@ -1290,14 +1299,6 @@
return attributes;
}
- if ( !schema.isInline( node ) ) {
- return null;
- }
-
- if ( !schema.isObject( node ) ) {
- return [];
- }
-
const attributes: Array<[string, unknown]> = [];
// Collect all attributes that can be applied to the text node.This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
mmotyczynska
approved these changes
Apr 7, 2026
Mati365
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


🚀 Summary
Improved document selection attribute inheritance around
<softBreak>so returning the caret after a soft break restores expected formatting.When selection attributes are recalculated across
<softBreak>, only attributes marked withcopyOnEnterare inherited. Other inline non-object elements still act as hard boundaries.📌 Related issues
brbreak inline elements? #1068.💡 Additional information
Optional: Notes on decisions, edge cases, or anything helpful for reviewers.
🧾 Checklists
Use the following checklists to ensure important areas were not overlooked.
This does not apply to feature-branch merges.
If an item is not relevant to this type of change, simply leave it unchecked.
Author checklist
Reviewer checklist
t()(if any).